
 beginoutdoorscript;

 variables;

 int i,j,k,r1,choice;

 body;

 beginstate INIT_STATE;

	if (get_flag(110,3) == 5)
		eliminate_outdoor_enc(100,6);

	if ((get_flag(100,8) >= 5) && (outdoor_enc_exists(100,9) == TRUE))
		eliminate_outdoor_enc(100,9);
	
	if (get_flag(110,3) == 5) {
		set_terrain(29,30,319);
		set_terrain(31,30,319);
		set_terrain(30,30,321);
}
	break;

 beginstate START_STATE;

	if (get_flag(110,3) == 1) {
		place_out_spec_enc(1,30,29);
		set_flag(110,3,2);
}

	if ((get_flag(110,3) == 5) && (is_outdoor() == TRUE))
		eliminate_outdoor_enc(100,6);

	if ((get_flag(100,8) >= 5) && (is_outdoor() == TRUE))
		eliminate_outdoor_enc(100,9);

	break;

beginstate 10;
	if (get_flag(100,0) == 0) {

		if (get_flag(100,22) == 0)
			message_dialog("The air in Quarhag Pass is still very humid from yesterday's rain. A rustling wind from the north pushes the air into your face. The sun peeks through a blanket of gray clouds and has, with the help of the soil, removed other traces of the rain.","It looks like this is going to be a hot and humid day. You do not see any signs of ogres, nor do you hear anything peculiar.");
		if (get_flag(100,22) == 1)
			message_dialog("The air in Quarhag Pass is still very humid from yesterday's rain. A rustling wind from the north pushes the air into your face. The sun peeks through a blanket of gray clouds and has, with the help of the soil, removed other traces of the rain.","It looks like this is going to be a hot and humid day. Apart from the three ogres that attacked you, you see no further signs of ogres, nor do you hear anything peculiar.");
		set_flag(100,0,1);
}
break;

beginstate 11;
	if (get_flag(100,1) == 0) {
		message_dialog("You locate the owner of the horse, or at least you thought you saw a glimpse of a hand or a leg behind a mass of fur. There happens to be about a dozen large worgs in your sight and they are eagerly devouring a corpse of a man.","Of course, your arrival puts an end to their meal. They bare their crimson fangs at you and charge without hesitation.");
		create_out_spec_enc(0);
		set_flag(100,1,1);
}
 break;

beginstate 12;
	reset_dialog();
	add_dialog_str(0,"You are victorious. You approach the savaged body of the poor man and notice that he was an Empire soldier. A messenger to be precise, judging by the symbol on his sleeve. All of his equipment is in ruins.",0);
	add_dialog_str(1,"You are just about to leave when a mournful howling stops you. Your gaze turns to the hills where you see more worgs; at least twice as many as the group before. Their eyes shine with hostility as they stare you down.",0);
	add_dialog_str(2,"Some of them move in a way that makes you think an attack is imminent, but suddenly the whole pack raises their heads in unison like they just heard something. Then they all turn around and lope away, leaving you unmolested.",0);
	run_dialog(1);
 break;

beginstate 13;
	if (get_flag(100,2) == 0) {
		reset_dialog();
		add_dialog_str(0,"You reach the peak of a small hill. It is not that high, but it still provides a small increase in your scope of vision in the pass. Nonetheless, you still see no ogres or other two-legged creatures anywhere.",0);
		add_dialog_str(1,"But you do see a pitch black pillar of smoke some three miles away. Based on what you have been told, it originates from where the Yelbro trade post should be. Some of your other senses register something before you decide to move on.",0);
		add_dialog_str(2,"You hear the sounds of a battle, though it is difficult to tell where exactly they are coming from. The pass has an odd way of echoing the sound so that pinpointing the location is impossible.",0);
		add_dialog_str(3,"It comes from nearby, however.",0);
		run_dialog(1);
		set_flag(100,2,1);
}
 break;

beginstate 14;
	if (get_flag(100,3) == 0) {
		reset_dialog();
		add_dialog_str(0,"You reach a forest clearing. Sounds of battle lead you here. They could be heard from pretty far away. You see about a dozen ogres, led by a spell-casting shaman, attacking a larger group of Empire soldiers.",0);
		add_dialog_str(1,"At first you thought that since there were more soldiers they would be winning. However this is not the case. The soldiers are on the verge of breaking and in the short time you were watching a few soldiers fell down while the ogres lost nobody.",0);
		add_dialog_str(2,"Your quiet inspection of the situation is cut short when the soldiers notice you and manage to fight their way to you. You are pulled into the fray.",0);
		run_dialog(1);
		set_flag(100,3,1);
}
 break;

beginstate 15;
	set_flag(100,8,1);
	reset_dialog();
	add_dialog_str(0,"The last ogre has perished. The soldiers begin to administer first aid to the wounded, nevertheless it looks like some of them will not make it. A blademaster, apparently a sergeant, approaches you deferentially.",0);
	add_dialog_str(1,"He introduces himself as Parks. _Thank the gods you showed up! We'd all be dead if it weren't for you and that would have meant that captain Leppington's squad would have died to the last man._ You ask what happened to Leppington.",0);
	add_dialog_str(2,"_The captain tried to stop the ogres at the Yelbro trade post, but he failed. The ogres were too numerous and we were forced to retreat. I don't actually know what happened to the captain. He wanted to make sure that no-one was left behind._",0);
	add_dialog_str(3,"_I guess he's still at the trade post. Well, his body is at any rate. Um, so what's the plan now?_",0);
	add_dialog_choice(0,"Parks! Gather up the soldiers and lead them back to Passton.");
	add_dialog_choice(1,"Every soldier still capable of holding a sword will come with me. We are going to take back the Yelbro trade post!");
	choice = run_dialog(1);

	if (choice == 1) {
		set_flag(100,4,5);
		message_dialog("The soldiers gather up their wounded and head for Passton. But not before some of them decide to thank you again and slap you in the back. You, however, should still go to the Yelbro Trade post and see what happened to Leppington.","");
		set_flag(60,1,1);
}
	if (choice == 2) {
		set_flag(100,4,1);
		message_dialog("A few of the soldiers are in no condition to fight, so they begin to march towards Passton. At least a half a dozen soldiers begin to follow you, though.","");
}
break;

beginstate 16;
	block_entry(1);
	reset_dialog();
	add_dialog_str(0,"This path takes you back south. Quarhag pass seems to be full of hostile creatures. You could circle around them by going south, but it would waste an impossible amount of time. You be late in your arrival in Sharimik.",0);
	add_dialog_str(1,"The interesting job you are seeking could be gone by the time you get there. Are you leaving Quarhag pass?",0);
	add_dialog_choice(0,"Not at all.");
	add_dialog_choice(1,"Yes, it is boring here.");
	choice = run_dialog(1);

	if (choice == 2) {
		reset_dialog();
		add_dialog_str(0,"You left Quarhag Pass to find another way to Sharimik. It was definitely not a fast route. When you finally arrived in Sharimik the job you wanted was gone. Asking around you heard that it was actually just taken.",0);
		add_dialog_str(1,"Time passed and news reached you from Quarhag Pass: Passton has been destroyed, but a punitive force is already underway. The ogres do not have a chance of survival. More time passed and the ogres were utterly annihilated.",0);
		add_dialog_str(2,"No-one ever found out what caused their aggression.",0);
		run_dialog(1);
		end_scenario(0);
}
 break;

beginstate 17;
	if (get_flag(100,5) == 1)
		print_str_color("This house is thoroughly looted.",1);

	if (get_flag(100,5) == 0) {
		reset_dialog();
		add_dialog_str(0,"You arrive at a small cottage near a forest. There is no smoke coming from the chimney nor do you see anyone in the vicinity of the house. You go inside. The house is empty. You do not see any signs of battle. The family probably just left their home.",0);
		add_dialog_str(1,"Doing so, they left most of their possessions behind. Not that their possessions amount to much. What do you do now?",0);
		add_dialog_choice(0,"Leave.");
		add_dialog_choice(1,"Loot the place of anything worth taking.");
		choice = run_dialog(1);

		if (choice == 2) {
			reset_dialog();
			add_dialog_str(0,"Your plan is a cunning one indeed. Due to the rampant chaos of the pass no-one is going to know that it was you who looted this cottage. The blame will most likely fall on the ogres.",0);
			add_dialog_str(1,"After a quick looting you have cleared the house of anything valuable. It is not worth much, but it is something. You look around you. Everything seems just a bit too neat.",0);
			add_dialog_str(2,"To further masquerade the deed as work of savage brutes like the ogres, you set the hut of fire.",0);
			set_flag(100,5,1);
			change_coins(74);
			reward_give(11);
}
}
 break;

beginstate 18;
	message_dialog("You have no idea where these three ogres came from, but they were determined to catch you. They attack you, practically squealing in glee. It looks like they've mistaken you for easy prey.","You are about to disappoint them.");
 break;

beginstate 19;
	if (get_flag(100,7) == 0) {
		message_dialog("There are fresh traces of blood on the ground, but the body does not look fresh. That might be due to the fact that the body has been stripped clean of flesh and is now a shiny new skeleton. It is not a human body, though, it is a horse.","There is still a saddle strapped around the backbone of the creature so this was not a wild horse. But whatever happened to the horse's rider?");
		set_flag(100,7,1);
}
 break;

beginstate 20;
	if (get_flag(100,4) == 1) {
		block_entry(1);
		message_dialog("Sergeant Parks calls a halt. _Listen, the trade post is right there. I suggest that we go straight in and don't try to circle around or anything. The ogres attacked from the north and they might have patrols there._","");
}
 break;

beginstate 21;
	if (get_flag(100,8) == 5) {
	message_dialog("Suddenly a bestial roar emerges from the woods. Soon after, almost a dozen ogres spring out of the woods lead by an ogre mage. They ambush you. The ogres hurl freshly lopped off heads of Imperial soldiers at you!","");
	create_out_spec_enc(2);
	set_flag(100,8,6);
	eliminate_outdoor_enc(100,9);
}
 break;
